package com.qf.air.controller;

import com.qf.air.vo.R;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zjw
 * @description
 * @date 2021/10/13 10:17
 */
@RestController
public class TaskController {

    @Resource
    private Scheduler myJobSchedule;

    @GetMapping("/task/stop")
    public R stop() throws SchedulerException {
        // 暂停执行
        myJobSchedule.pauseAll();
        return R.ok();
    }

    @GetMapping("/task/start")
    public R start() throws SchedulerException {
        // 恢复执行
        myJobSchedule.resumeAll();
        return R.ok();
    }
}
